﻿using Cysharp.Threading.Tasks;

namespace uMVP
{
    public interface IViewInitialize
    {
        UniTask OnInitializeAsync();
    }

    public interface IViewDestroy
    {
        void Destroy();
    }

    public interface IActivity : IViewDestroy
    {
        /// <summary>
        /// 打开
        /// </summary>
        UniTask OpenAsync();

        /// <summary>
        /// 关闭
        /// </summary>
        UniTask CloseAsync();
    }

    public interface IView : IViewInitialize, IViewDestroy, IActivity
    {
    }

    public interface IView<TPresenterInterface> : IViewInitialize, IViewDestroy
        where TPresenterInterface : class
    {
        TPresenterInterface Presenter { get; }

        void SetPresenter(TPresenterInterface presenter);
    }

    public interface IView<TPresenterInterface, TPresenterFactory> : IView<TPresenterInterface>
        where TPresenterInterface : class
    {
        TPresenterInterface OnCreatePresenter(TPresenterFactory factory);
    }
}